//
//  WPHomeScrollView.m
//  wobingwoyi
//
//  Created by WGP on 16/7/26.
//  Copyright © 2016年 WGP. All rights reserved.
//

#import "WPHomeContentView.h"
#import "WPSecondView.h"
#import "WPThirdView.h"
#import "WPLoopView.h"

@interface WPHomeContentView ()

@end

@implementation WPHomeContentView

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        [self setupUI];
        
        self.bounces = NO;
    }
    return self;
}

-(void)setupUI
{

    self.backgroundColor = RGB_COLOR(245, 245, 245);
    
//    self.headerLoopView = [[WPHeaderLoopView alloc] init];
//    [self addSubview:self.headerLoopView];
    
    UIView *firstView = [UIView new];
    firstView.backgroundColor = [UIColor whiteColor];
    firstView.frame = CGRectMake(10, SCREEN_WIDTH/BANDER_SCALE + 7.5, SCREEN_WIDTH-20, 30);
    firstView.layer.cornerRadius = 8;
    firstView.layer.masksToBounds = YES;
    [self addSubview:firstView];
    
    UIImageView *leftImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"rightList"]];
    UIImageView *rightImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"rightList"]];
    UILabel *titleLabel = [UILabel new];
    titleLabel.textColor = RGB_SAME(102);
    titleLabel.font = [UIFont systemFontOfSize:14];
    titleLabel.text = @"总有一份与你相似的病例";
    [firstView addSubview:leftImageView];
    [firstView addSubview:rightImageView];
    [firstView addSubview:titleLabel];
    
    [leftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(firstView);
        make.left.equalTo(firstView).offset(17);
    }];
    [rightImageView mas_makeConstraints:^(MASConstraintMaker *make) {

        make.centerY.equalTo(firstView);
        make.right.equalTo(firstView).offset(-17);
    }];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(firstView);
    }];
    
    self.secondView = [WPSecondView new];
    [self addSubview:self.secondView];
    
    
    self.thirdView = [[WPThirdView alloc] init];
    [self addSubview:self.thirdView];
    
    
    [self.secondView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.width.equalTo(self);
        make.top.equalTo(self).offset(SCREEN_WIDTH/BANDER_SCALE+45);
        make.height.mas_equalTo(85*SCALE);
    }];
    
    [self.thirdView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.secondView.mas_bottom).offset(10*SCALE);
        make.left.equalTo(self);
        make.width.mas_equalTo(SCREEN_WIDTH);
        make.height.mas_equalTo(299*SCALE);
    }];
}

@end
